package nacosDemo.controller;

import nacosDemo.feign.TestFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class NacosAtest {

    @Autowired
    DiscoveryClient dis;

    @Autowired
    TestFeign testFeign;

    @Value("${name}")
    private String name;

    @GetMapping("/testA")
    public String findB(){
        List<ServiceInstance> instances = dis.getInstances("service-b");
        System.out.println(instances);
        System.out.println(name);
        return testFeign.testB();
//        return "testA";
    }
}
